package upm.pb4agent.team5.common;

import jade.domain.FIPAException;
import upm.pb4agent.team5.BaseAgent;
import upm.pb4agent.team5.util.WatcherPhysics;

public class Watcher extends BaseAgent {
	private static final long serialVersionUID = 4611981413727427679L;
	public final static String DF_NAME = "Watcher";
	public final static String DOCK_NAME[] = { "A", "B", "C", "D" }; 
	
	private WatcherPhysics watcherPhysics = null; 
	
    public Watcher() {
		super(DF_NAME);
		watcherPhysics = new WatcherPhysics();
	}
    
	/**
     * Method executed when agent is initialized
     */
	protected void setup() {
		setDfName(getLocalName()); // For register agent in DF with its localName as DF_NAME
		
		System.out.println(getLocalName() + ": Enters the system");

		try {
			registerAgent();
			System.out.println(getLocalName() + ": Registered in DF");
			
			addBehaviour(new BWatcherManageMessages(this));
		} catch (FIPAException e) {
			System.err.println(getLocalName()+": Cannot register in DF");
			doDelete(); // Terminating agent
		}
	}

	public WatcherPhysics getWatcherPhysics() {
		return watcherPhysics;
	}
}
